import request from '@/config/axios'

// 用药计划 VO
export interface MedicationPlanVO {
  planId: number // 计划ID
  userId: number // 用户id
  medicineId: number // 药品ID
  dosagePerTime: string // 每次剂量(如1片)
  frequency: string // 用药频率
  timesPerDay: number // 每日次数
  specificTimes: string // 具体时间点(如["08:00","12:00","20:00"])
  startDate: Date // 开始日期
  endDate: Date // 结束日期
  remindMethods: string // 提醒方式(如["APP","SMS"])
  relationFood: string // 饮食关联说明
  status: string // 计划状态
}

// 用药计划 API
export const MedicationPlanApi = {
  // 查询用药计划分页
  getMedicationPlanPage: async (params: any) => {
    return await request.get({ url: `/remind/medication-plan/page`, params })
  },

  // 查询用药计划详情
  getMedicationPlan: async (id: number) => {
    return await request.get({ url: `/remind/medication-plan/get?id=` + id })
  },

  // 新增用药计划
  createMedicationPlan: async (data: MedicationPlanVO) => {
    return await request.post({ url: `/remind/medication-plan/create`, data })
  },

  // 修改用药计划
  updateMedicationPlan: async (data: MedicationPlanVO) => {
    return await request.put({ url: `/remind/medication-plan/update`, data })
  },

  // 删除用药计划
  deleteMedicationPlan: async (id: number) => {
    return await request.delete({ url: `/remind/medication-plan/delete?id=` + id })
  },

  // 导出用药计划 Excel
  exportMedicationPlan: async (params) => {
    return await request.download({ url: `/remind/medication-plan/export-excel`, params })
  },
}